//Interface for game 2D 

#ifndef GAME_H
#define GAME_H

#ifndef __STRUCT_RECT__
#define __STRUCT_RECT__

//Struct rectangle
typedef struct Rect
{	
    float left;
	float top;
	float right;
	float bottom;
}Rect;
#endif

namespace game
{
//Interface game manager 
class Game
{	
  public:
    virtual void Run() = 0;     //Execute game
    virtual ~Game() = 0;        //Destructor game		
		
  protected:
    virtual bool Init() = 0;                        //Init game
    virtual bool LoadContent() = 0;	                //Load resource game
    virtual void Update(unsigned int = 0) = 0;      //Update game : dispose logic game (in game's loop)
    virtual void Render(unsigned int = 0) = 0;      //Render game : display game (in game's loop)
};

inline Game::~Game() { }

//Interface graphic manager
class GameGraphic
{	
  public:
    virtual bool Init() = 0;                    //Init graphic device
    virtual void* GetDevice() = 0;              //Get graphic device
    virtual int GetWidthScreen() = 0;           //Get width screen
    virtual int GetHeightScreen() = 0;          //Get height screen
    virtual bool BeginRender() = 0;             //Start render must be called before render
    virtual bool EndRender() = 0;               //End render must be called after render
    virtual bool IsFullScreen() = 0;            //Check mode of screen
    //virtual void ChangeModeScreen() = 0;      //Change mode of screen : window <-> fullscreen
    //virtual bool ApplyChange() = 0;           //Apply change mode : must be called after function ChangeModeScreen()
    virtual ~GameGraphic() = 0;                 //Destructor
};

inline GameGraphic::~GameGraphic() { }

//Interface input manager
class GameInput
{	
  public:
    virtual bool Init() = 0;						    //Init input device
    virtual void GetState() = 0;					    //Get state keyboard, mouse...
    virtual bool IsKeyDown(unsigned char) = 0;		    //Check key down
    virtual bool IsKeyUp(unsigned char) = 0;		    //Check key up
    virtual bool IsKeyPress(unsigned char) = 0;		    //Check key press
    virtual bool IsKeyRelease(unsigned char) = 0;	    //Check key unpressed
    virtual bool IsMouseDown(unsigned char) = 0;	    //Check mouse down
    virtual bool IsMouseUp(unsigned char) = 0;		    //Check mouse up
    virtual bool IsMouseMove() = 0;					    //Check mouse move
    virtual float GetMouseMove_X() = 0;				    //Get differenced X-coordinate of mouse
    virtual float GetMouseMove_Y() = 0;				    //Get differenced Y-coordinate of mouse
    virtual float GetMouseMove_Z() = 0;				    //Get differenced Z-coordinate of mouse
    virtual float GetPosX() = 0;					    //Get X-coordinate of mouse represent on screen
    virtual float GetPosY() = 0;					    //Get Y-coordinate of mouse represent on screen
    virtual ~GameInput() = 0;						    //Destructor
};

inline GameInput::~GameInput() { }

//Interface sound manager
class GameSound
{	
  public:
    virtual bool Init() = 0;										    //Init sound device
    virtual bool LoadBackgroundSound(const char*, const char*) = 0;     //Load background sound with sound's name and sound's alias
    virtual bool LoadSound(const char*, const char*) = 0;			    //Load sound with sound's name and sound's alias
    virtual void UnLoadSound(const char*) = 0;						    //Unload sound correspond sound's alias
    virtual void Play(const char*) = 0;								    //Play sound correspond sound's alias
    virtual void Stop(const char*) = 0;								    //Stop sound correspond sound's alias
    virtual void Pause(const char*) = 0;							    //Pause sound correspond sound's alias
    virtual void Resume(const char*) = 0;							    //Resume sound correspond sound's alias
    virtual ~GameSound() = 0;										    //Destructor
};

inline GameSound::~GameSound() { }

//Interface object manager
class GameObject
{	
  public:
    virtual Rect GetRectBound() = 0;				    //Get rectangle bound object
    virtual int GetLayer() = 0;						    //Get object's layer to rendering
    virtual void SetOrigin(float, float) = 0;		    //Set origin of object to rendering
    virtual void Update(unsigned int = 0) = 0;		    //Update object : dispose act of object (control, collision...)
    virtual void Render(unsigned int = 0) = 0;		    //Render object : display object
    virtual ~GameObject() = 0;						    //Destructor
};

inline GameObject::~GameObject() { }

//Interface sprite
class Sprite
{	
  public:
    virtual int GetNumberSprite() = 0;				    //Get number sprite
    virtual float GetWidth() = 0;					    //Get width of sprite
    virtual float GetHeight() = 0;					    //Get heigth of sprite
    virtual float GetCoordinate_X() = 0;			    //Get X-coordinate of sprite
    virtual float GetCoordinate_Y() = 0;			    //Get Y-coordinate of sprite
    virtual void SetPosition(float, float) = 0;		    //Set position of sprite (X-coordinate, Y-coordinate)
    //Display sprite with (number k-sprite, scale, transparent, angleRotation, X-PointRotation, Y-PointRotation)
    virtual void Draw(int = 0, float = 1.0f, int = 255, float = 0.0f, float = 0.0f, float = 0.0f) = 0;	
    virtual ~Sprite() = 0;							    //Destructor
};

inline Sprite::~Sprite() { }

//Interface surface
class Surface
{	
  public:
    virtual float GetWidth() = 0;                       //Get width of surface
    virtual float GetHeight() = 0;                      //Get height of surface
    virtual void Draw() = 0;                            //Draw image use surface (draw background)
    virtual void Draw(int, int, int = 1) = 0;           //Draw image use surface (X-coordinate, Y-coordinate, scale)
    virtual ~Surface() = 0;                             //Destructor
};

inline Surface::~Surface() { }

}
#endif